package org.news.beans;

import org.apache.ibatis.type.Alias;
import org.springframework.util.DigestUtils;

/**
 * Created by lenovo on 2016/5/11.
 */
@Alias("users")
public class Users {
    private int userid;
    private String username;
    private String userpwd;

    public Users() {
    }

    public Users(int userid, String username, String userpwd) {
        this.userid = userid;
        this.username = username;
        this.userpwd = userpwd;
    }

    public int getUserid() {
        return userid;
    }

    public void setUserid(int userid) {
        this.userid = userid;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getUserpwd() {
        return userpwd;
    }

    public void setUserpwd(String userpwd) {
        String s = userpwd;
        String hex = DigestUtils.md5DigestAsHex(s.getBytes());
        for (int i = 1; s.length() > i; i++) {
            hex = DigestUtils.md5DigestAsHex(hex.getBytes());
        }
        this.userpwd = hex;
    }
    public String toString() {
        return " [ " + userid + " , " + username + " , " + userpwd + " ] ";
    }
}

